package started;





import Implementation.ServerImpl;
import delegate.DelegateServer;
import entility.CheckServerList;
import entility.Machine;

public class StartedServer {

	public static void main(String[] args) {

		ReadProperties props = new ReadProperties();
		
		Machine primaryServer = props.getPrimaryServer();
		Machine thisServer = props.getThisServer();
		
		System.out.println(primaryServer);
		
		if(primaryServer.ip.equals(thisServer.ip))
		{
			ServerImpl.getInstance(thisServer);
		}
		else
		{
			ServerImpl.getInstance(thisServer, primaryServer);
			CheckServerList serverCheck = new CheckServerList(primaryServer, thisServer);
			Thread t = new Thread(serverCheck);
			t.start();
			
		}
			

		new DelegateServer(thisServer.port);
	}

	
	
	
	


}
